#include <stdio.h>
#include <unistd.h>

main() {
  if (chdir("/tmp") != 0)
    perror("chdir() to /tmp failed");
  if (chdir("/chdir/error") != 0)
    perror("chdir() to /chdir/error failed");
}

/*
The output for this example should be:

chdir() to /chdir/error failed: No such path or directory.
*/